package com.fhj.movie.activity;

import com.fhj.movie_fhj_01.R;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class HyyGuanYuActivity extends Activity {
	private ImageView imageView;
	SelectPicPopupWindow menuWindow;
	private LinearLayout layout;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_guanyu);
		imageView=(ImageView)findViewById(R.id.guanyu_telephone);
		layout=(LinearLayout)this.findViewById(R.id.guanyu_guanyu);
		layout.getBackground().setAlpha(0);
		imageView.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				menuWindow = new SelectPicPopupWindow(HyyGuanYuActivity.this,
						itemsOnClick);
				// 显示窗口
				menuWindow.showAtLocation(
						HyyGuanYuActivity.this.findViewById(R.id.guanyu_telephone), Gravity.BOTTOM
								| Gravity.CENTER_HORIZONTAL, 0, 0);
				layout.setVisibility(View.VISIBLE);
				layout.getBackground().setAlpha(125);
			}
		});
		
		layout.setVisibility(View.INVISIBLE);
	}
	private OnClickListener  itemsOnClick = new OnClickListener(){  
		  
        public void onClick(View v) {  
            menuWindow.dismiss();  
            switch (v.getId()) {  
            case R.id.cancle:
            	menuWindow.dismiss();
            	layout.setVisibility(View.INVISIBLE);
                break;  
            case R.id.phone:  
            	Uri uri = Uri.parse("tel:020-83568090");    
            	Intent intent = new Intent(Intent.ACTION_DIAL, uri);       
            	startActivity(intent); 
            	layout.setVisibility(View.INVISIBLE);
            	
                break;  
            default:  
                break;  
            }  
              
                  
        }  
          
    };  
}
